#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/7/22 22:26
# @Author  : Jet
# @Email   : jyan@abot.cn
# @File    : my_functions.py


import hashlib
import json
import time


def md5(str001):
    return hashlib.md5(str001.encode()).hexdigest()


def json_encode(obj001):
    return json.dumps(obj001, ensure_ascii=False)


def json_decode(json_str001):
    return json.loads(json_str001)


def time_stamp():
    return round(time.time())


def time_date_str(format001="%Y-%m-%d %H:%M:%S", localtime001=0):
    if localtime001 == 0:
        localtime001 = time.localtime()

    date001 = time.strftime(format001, localtime001)

    return date001


